home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1992-08-28  |  3.5 KB  |  159 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Saturday, July 27, 1991 at 8:49 PM
  4.  Events.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1985-1992
  8.   All rights reserved
  9.  
  10. *** Warning: This is an alpha version of the Interfaces for Cube-E. 
  11. ***          Things may change.  Caveat Programmer.
  12.  
  13.  
  14. }
  15.  
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Events;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED UsingEvents}
  27. {$SETC UsingEvents := 1}
  28.  
  29. {$I+}
  30. {$SETC EventsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32. {$IFC UNDEFINED UsingTypes}
  33. {$I $$Shell(PInterfaces)Types.p}
  34. {$ENDC}
  35. {$IFC UNDEFINED UsingQuickdraw}
  36. {$I $$Shell(PInterfaces)Quickdraw.p}
  37. {$ENDC}
  38. {$IFC UNDEFINED UsingOSUtils}
  39. {$I $$Shell(PInterfaces)OSUtils.p}
  40. {$ENDC}
  41. {$SETC UsingIncludes := EventsIncludes}
  42.  
  43. CONST
  44. nullEvent = 0;
  45. mouseDown = 1;
  46. mouseUp = 2;
  47. keyDown = 3;
  48. keyUp = 4;
  49. autoKey = 5;
  50. updateEvt = 6;
  51. diskEvt = 7;
  52. activateEvt = 8;
  53. osEvt = 15;
  54.  
  55. { event mask equates }
  56. mDownMask = 2;
  57. mUpMask = 4;
  58. keyDownMask = 8;
  59. keyUpMask = 16;
  60. autoKeyMask = 32;
  61. updateMask = 64;
  62. diskMask = 128;
  63. activMask = 256;
  64. highLevelEventMask = 1024;
  65. osMask = -32768;
  66. everyEvent = -1;
  67.  
  68. { event message equates }
  69. charCodeMask = $000000FF;
  70. keyCodeMask = $0000FF00;
  71. adbAddrMask = $00FF0000;
  72. osEvtMessageMask = $FF000000;
  73.  
  74. { OS event messages.  Event (sub)code is in the high byte of the message field. }
  75. mouseMovedMessage = $FA;
  76. suspendResumeMessage = $01;
  77.  
  78. resumeFlag = 1;                { Bit 0 of message indicates resume vs suspend }
  79. convertClipboardFlag = 2;    { Bit 1 in resume message indicates clipboard change }
  80.  
  81. { modifiers }
  82. activeFlag = 1;                { Bit 0 of modifiers for activateEvt and mouseDown events }
  83. btnState = 128;                { Bit 7 of low byte is mouse button state }
  84. cmdKey = 256;                { Bit 0 }
  85. shiftKey = 512;                { Bit 1 }
  86. alphaLock = 1024;            { Bit 2 }
  87. optionKey = 2048;            { Bit 3 of high byte }
  88. controlKey = 4096;
  89.  
  90. { obsolete equates }
  91. networkEvt = 10;
  92. driverEvt = 11;
  93. app1Evt = 12;
  94. app2Evt = 13;
  95. app3Evt = 14;
  96. app4Evt = 15;
  97. networkMask = 1024;
  98. driverMask = 2048;
  99. app1Mask = 4096;
  100. app2Mask = 8192;
  101. app3Mask = 16384;
  102. app4Mask = -32768;
  103.  
  104. TYPE
  105. EventRecord = RECORD
  106.  what: INTEGER;
  107.  message: LONGINT;
  108.  when: LONGINT;
  109.  where: Point;
  110.  modifiers: INTEGER;
  111.  END;
  112.  
  113.  
  114. KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  115.  
  116. FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  117.  INLINE $A970;
  118. FUNCTION WaitNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord;sleep: LONGINT;
  119.  mouseRgn: RgnHandle): BOOLEAN;
  120.  INLINE $A860;
  121. FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  122.  INLINE $A971;
  123. PROCEDURE GetMouse(VAR mouseLoc: Point);
  124.  INLINE $A972;
  125. FUNCTION Button: BOOLEAN;
  126.  INLINE $A974;
  127. FUNCTION StillDown: BOOLEAN;
  128.  INLINE $A973;
  129. FUNCTION WaitMouseUp: BOOLEAN;
  130.  INLINE $A977;
  131. PROCEDURE GetKeys(VAR theKeys: KeyMap);
  132.  INLINE $A976;
  133. FUNCTION TickCount: LONGINT;
  134.  INLINE $A975;
  135. FUNCTION GetDblTime: LONGINT;
  136.  INLINE $2EB8,$02F0;
  137. FUNCTION GetCaretTime: LONGINT;
  138.  INLINE $2EB8,$02F4;
  139.  
  140. FUNCTION PostEvent(eventNum: INTEGER;eventMsg: LONGINT): OSErr;
  141. FUNCTION PPostEvent(eventCode: INTEGER;eventMsg: LONGINT;VAR qEl: EvQElPtr): OSErr;
  142. FUNCTION OSEventAvail(mask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  143. FUNCTION GetOSEvent(mask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  144. PROCEDURE FlushEvents(whichMask: INTEGER;stopMask: INTEGER);
  145.  INLINE $201F,$A032;
  146. PROCEDURE SetEventMask(theMask: INTEGER);
  147.  INLINE $31DF,$0144;
  148. FUNCTION GetEvQHdr: QHdrPtr;
  149.  INLINE $2EBC,$0000,$014A;
  150.  
  151.  
  152.  
  153. {$ENDC} { UsingEvents }
  154.  
  155. {$IFC NOT UsingIncludes}
  156.  END.
  157. {$ENDC}
  158.  
  159.